package com.wxzz.elearing.user.service.openfeign;

import com.alibaba.fastjson.JSONObject;
import com.wxzz.elearing.user.service.openfeign.sentinel.CurriculumApiFeignImpl;
import com.wxzz.elearning.common.dto.FeignStudyTimeDto;
import com.wxzz.elearning.common.vo.ReturnVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import java.util.List;

@FeignClient(value = "2125-wxzzlearn-course-application",fallback = CurriculumApiFeignImpl.class)
public interface ICurriculumApiFeign {

    /**
     * 查询培训调查绑定的用户
     * @param trainSurveyId
     * @param wxUserIds
     * @return
     */
    @RequestMapping(value = "/train-survey-api/selectWxUserTrainSurvey/{trainSurveyId}", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
    ReturnVO<List<JSONObject>> selectWxUserTrainSurvey(@PathVariable Long trainSurveyId, @RequestBody List<Long> wxUserIds);

    /**
     * 查询学习计划绑定的用户
     * @param wxUserStudyPlanId
     * @param wxUserIds
     * @return
     */
    @RequestMapping(value = "/wx-user-study-plan-api/selectWxUserStudyPlan/{wxUserStudyPlanId}", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
    ReturnVO<List<JSONObject>> selectWxUserStudyPlan(@PathVariable Long wxUserStudyPlanId, @RequestBody List<Long> wxUserIds);

    /**
     * 根据微信用户id查询学习课程数据
     *
     * @param wxUserId
     * @return
     */
    @RequestMapping(value = "/curriculum-api/selectWxUserCurriculumDataByWxUserId/{wxUserId}", method = RequestMethod.POST)
    ReturnVO<String> selectWxUserCurriculumDataByWxUserId(@PathVariable(value = "wxUserId") Long wxUserId);

    /**
     * 根据讲师id查询总讲数和参与学习人数
     *
     * @param docentId
     * @return
     */
    @RequestMapping(value = "/curriculum-api/selectDocentById/{docentId}", method = RequestMethod.POST)
    ReturnVO<String> selectDocentById(@PathVariable(value = "docentId") Long docentId);


    /**
     * 查询企业的学习时长
     *
     * @param enterpriseId
     * @return
     */
    @RequestMapping(value = "/curriculum-api/selectFeignStudyTimeDto/{enterpriseId}", method = RequestMethod.POST)
    FeignStudyTimeDto selectFeignStudyTimeDto(@PathVariable Long enterpriseId);

    @RequestMapping(value = "/curriculum-api/selectCountByEnterpriseId/{enterpriseId}", method = RequestMethod.POST)
    Integer selectCountByEnterpriseId(@PathVariable Long enterpriseId);
}
